<!--
  Copyright 2014-2018 the original author or authors.

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<div ng-include src="'template/gt-http-error-overlay.html'"></div>
<div class="gt-not-header d-inline-block pb-3 pl-5">
  <div ng-controller="ChartRangeCtrl" ng-include="'template/gt-chart-range.html'"></div>
</div>
<div class="clearfix">
  <div class="gt-chart-controls float-right">
    <button class="gt-chart-button"
            ng-click="zoomOut()">
      <span title="Zoom out"
            class="fas fa-search-minus">
      </span>
    </button>
    <button class="gt-chart-button"
            ng-click="refresh()">
      <span title="Refresh"
            class="fas fa-sync">
      </span>
    </button>
    <button class="gt-chart-button"
            uib-popover-template="'template/help/chart.html'"
            popover-placement="left"
            popover-trigger="'outsideClick'">
      <span title="Help"
            class="fas fa-question-circle">
      </span>
    </button>
  </div>
</div>
<div class="gt-chart-container"
     style="margin-left: -10px;">
  <div gt-spinner
       gt-show="showChartSpinner"
       gt-no-delay="true"
       class="gt-panel-overlay gt-chart-panel"
       id="chartSpinner">
  </div>
  <div class="gt-chart-dimensions" id="chart"></div>
  <div ng-if="chartNoData && !showChartSpinner"
       class="gt-chart-panel"
       style="display: table;">
    <div style="display: table-cell; text-align: center; vertical-align: middle;">
      <div ng-if="allGauges.length && gaugeNames.length" class="gt-chart-no-data">No data</div>
      <div ng-if="allGauges.length && !gaugeNames.length" class="gt-chart-no-data">Select one or more gauges below</div>
      <div ng-if="!allGauges.length" class="gt-chart-no-data">No gauges captured in this time period</div>
    </div>
  </div>
</div>
<!-- pl-2 is to account for y-axis legend pushing chart over to the right a bit -->
<div class="pl-3"
     id="chartLegend"
     style="text-align: center; margin-top: 10px; width: 100%;">
  <div class="d-inline-block">
    <div class="d-inline-block" ng-repeat="seriesLabel in seriesLabels"
         style="white-space: nowrap; margin: 0 6px;">
      <div class="legendColorBox d-inline-block"
           style="border: 1px solid rgb(204, 204, 204); padding: 1px;">
        <div style="width: 4px; height: 0; border: 5px solid rgb(237, 194, 64); overflow: hidden;"
             ng-style="{'border': '5px solid ' + seriesLabel.color}">
        </div>
      </div>
      <div class="legendLabel d-inline-block">{{seriesLabel.text}}
        <span ng-if="showGaugeScales()">
          (<span style="vertical-align: -1px;">&times;</span>{{getGaugeScale(seriesLabel.name)}})
        </span>
      </div>
    </div>
  </div>
</div>
<div class="pt-5 pl-5">
  <div class="pb-3">
    <input type="text"
           class="form-control d-inline-block"
           ng-model="page.gaugeFilter"
           placeholder="filter the gauge list"
           aria-label="Gauge list filter"
           style="max-width: 500px;">
  </div>
  <label ng-repeat="gauge in allGauges | filter:{display: page.gaugeFilter}"
         class="custom-control custom-checkbox"
         ng-style="gaugeNameStyle(gauge.name)">
    <input type="checkbox"
           class="custom-control-input"
           ng-checked="gaugeNames.indexOf(gauge.name) !== -1"
           ng-click="clickGaugeName(gauge.name)">
    <div class="custom-control-label">
      {{gauge.display}}
    </div>
  </label>
  <div class="mt-4">
    <button class="btn btn-secondary"
            ng-click="selectAllGauges()">
      select all {{!showingAllGauges() ? 'showing' : ''}}
    </button>
    <button class="btn btn-secondary"
            ng-click="deselectAllGauges()"
            style="margin-left: 5px;">
      deselect all {{!showingAllGauges() ? 'showing' : ''}}
    </button>
  </div>
</div>
